//
//  EditUserInfoModel.m
//  QuickCure1
//
//  Created by apple on 2016/11/6.
//  Copyright © 2016年 maoge. All rights reserved.
//

#import "EditUserInfoModel.h"
#import "Users.h"
@implementation EditUserInfoModel

//- (instancetype)init{
//    
//    if (self = [super init]) {

//        [[UserManager sharedManager] getUserInfoFromCache];
//        
//        Users *us = [UserManager sharedManager].userInfo;
//        
//        self.province_id = [NSString stringWithFormat:@"%zd",[us.province_id intValue]];
//        self.city_id = [NSString stringWithFormat:@"%zd",[us.city_id integerValue]];
//        self.weight = us.weight;
//        self.height = us.height;
        
//    }
//    return self;
//}

//告诉系统哪些属性要归档
//存
- (void)encodeWithCoder:(NSCoder *)aCoder{
    unsigned int count = 0;
    Ivar *ivars = class_copyIvarList([self class], &count);
    for (int i = 0; i < count; i++) {
        Ivar ivar = ivars[i];
        const char *name = ivar_getName(ivar);
        NSString *key = [NSString stringWithUTF8String:name];
        id value = [self valueForKey:key];
        [aCoder encodeObject:value forKey:key];
    }
    free(ivars);
}


//告诉系统哪些属性可以获取
//取
- (instancetype)initWithCoder:(NSCoder *)aDecoder{
    if (self = [super init]) {
        unsigned int count = 0;
        Ivar *ivars = class_copyIvarList([self class], &count);
        for (int i = 0; i < count; i++) {
            Ivar ivar = ivars[i];
            const char *name = ivar_getName(ivar);
            NSString *key = [NSString stringWithUTF8String:name];
            id value = [aDecoder decodeObjectForKey:key];
            [self setValue:value forKey:key];
        }
        free(ivars);
    }
    return self;
}



@end
